package com.ebelter.btlibrary.util;

import android.content.Context;
import android.provider.Settings;

/**
 * Created by pan on 2017/11/7.
 */

public class SystemTool {


    // 根据手机获取
    public static String genertMac(Context ctx) {
        String str = Settings.Secure.getString(ctx.getContentResolver(),
                Settings.Secure.ANDROID_ID);
        StringBuilder sb = new StringBuilder();
        if (str != null && str.length() > 2) {
            sb.append(str.substring(0, 2));
            for (int i = 2; i < 12; i += 2) {
                sb.append(":");
                if (str.length() - 2 < i) {
                    sb.append("00");
                } else {
                    sb.append(str.substring(i, i + 2));
                }
            }
        }
        return sb.toString();
    }






}
